package com.etc.controller;

import com.etc.entity.Area;
import com.etc.entity.City;
import com.etc.entity.Province;
import com.etc.service.impl.IndexServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping()
public class IndexController {
    @Autowired
    IndexServiceImpl servcie;

    @RequestMapping(value = "/finDall",method = RequestMethod.GET)
    public List<Province> finDall(){
        List<Province> list = servcie.getAllProvince();
        return list;
    }

    @RequestMapping(value = "/findByPid",method = RequestMethod.GET)
    public List<City> findByPid(@RequestParam("provinceId")String provinceId){
        List<City> list = servcie.getCityByPid(provinceId);
        return list;
    }

    @RequestMapping(value = "/findByCid",method = RequestMethod.GET)
    public List<Area> findByCid(@RequestParam("cityId")String cityId){
        List<Area> list = servcie.getAreaByCid(cityId);
        return list;
    }
}
